﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography.X509Certificates;
using System.Linq.Expressions;
using System.ComponentModel;

namespace Client
{
    class Program
    {


        static void Main(string[] args)
        {
            //report.ReportXmlClient client = new report.ReportXmlClient();
            //string str = client.SelectReportXml("1243");

            ServiceReference4.GenericRecordContractClient client = new ServiceReference4.GenericRecordContractClient();
            //client.SaveException(new ServiceReference5.Error()
            //{
            //    AssemblyName = "AssemblyName",
            //    IpAddress = "IpAddress",
            //    ClassName = "ClassName",
            //    Date = DateTime.Now,
            //    ErrorCode = "ErrorCode",
            //    ErrorMsg = "ErrorMsg",
            //    ErrorSource = "ErrorSource",
            //    ErrorStack = "ErrorStack",
            //    Host = "Host",
            //    Method = "Method",
            //    Module = "Module",
            //    NameSpace = "NameSpace",
            //    Note = "Note",
            //    Platform = "Platform",
            //    UserCode = "UserCode",
            //    UserName = "UserName"
            //});


            client.SaveGenericRecord(new ServiceReference4.GenericRecord_Model()
            {
                CreateDate = DateTime.Now,
                Id = 0,
                IP = "0000",
                RealName = "0000",
                Description = "aaa",
                OperationType = "0000",
                SystemTypeId = "0",
                UserCode = "00000",
                UserName = "0000",
                FunModel_ID = 0021,
                FunModel_NM = "aaa",
                FunModel_CD = "afdsa1321",
                Function_NM = "dsafdsafdsafdsaf",
                LogType = 2

            });



            //=========================
            //ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
            ////查询客户端已安装的证书   身份认证
            ////client.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySubjectDistinguishedName, "CN=wcfClient1");
            ////client.ClientCredentials.ServiceCertificate.DefaultCertificate

            //string str = client.Hello("aaa");
            //string str2 = client.Hello("aaa");
            //string str3 = client.Hello("aaa");
            //string str4 = client.Hello("aaa");
            //Console.WriteLine(str);
            //Console.WriteLine(str2);
            //Console.WriteLine(str3);
            //Console.WriteLine(str4);
            //Console.Read();


            //=========================
            //ServiceReference2.Service1Client sclient = new ServiceReference2.Service1Client();
            ////查询客户端已安装的证书   身份认证
            ////client.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySubjectDistinguishedName, "CN=wcfClient1");
            ////client.ClientCredentials.ServiceCertificate.DefaultCertificate

            //int str2 = sclient.MyConvert("1");
            //Console.WriteLine(str2);


            ////=========================
            //ServiceReference3.Service1Client sclient2 = new ServiceReference3.Service1Client();
            ////查询客户端已安装的证书   身份认证
            ////client.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySubjectDistinguishedName, "CN=wcfClient1");
            ////client.ClientCredentials.ServiceCertificate.DefaultCertificate

            //int str3 = sclient2.MyConvert("3");
            //Console.WriteLine(str3);
            //Console.Read();




            ////=========================
            //ServiceReference4.GenericRecordContractClient track = new ServiceReference4.GenericRecordContractClient();
            ////List<KeyValuePair<string, object>> list = new List<KeyValuePair<string, object>>();
            ////Dictionary<string, object> dict = new Dictionary<string, object>();

            ////dict.Add("Id", "1111122");
            ////dict.Add("Application", "111111");
            ////dict.Add("Date", DateTime.Now);
            ////dict.Add("Host", "333333");
            ////dict.Add("Message", "444444");
            ////dict.Add("Note", "55555");
            ////dict.Add("Operator", "66666");
            ////dict.Add("Source", "77777");
            ////dict.Add("Type", "88888");
            //////new ErrorInfo()
            //////{
            //////    Application = "",
            //////    Date = DateTime.Now,
            //////    Host = "",
            //////    Message = "",
            //////    Note = "",
            //////    Operator = "",
            //////    Source = "",
            //////    Type = ""
            //////});
            ////foreach (KeyValuePair<string, object> item in dict)
            ////{
            ////    list.Add(item);
            ////}

            ////track.SaveOperationTrack("errorLog", list.ToArray());
            //track.SaveException(new ServiceReference4.Error()
            //{
            //    AssemblyName = "AssemblyName",
            //    IpAddress = "IpAddress",
            //    ClassName = "ClassName",
            //    Date = DateTime.Now,
            //    ErrorCode = "ErrorCode",
            //    ErrorMsg = "ErrorMsg",
            //    ErrorSource = "ErrorSource",
            //    ErrorStack = "ErrorStack",
            //    Host = "Host",
            //    Method = "Method",
            //    Module = "Module",
            //    NameSpace = "NameSpace",
            //    Note = "Note",
            //    Platform = "Platform",
            //    UserCode = "UserCode",
            //    UserName = "UserName"
            //});

            //track.SaveGenericRecord(new ServiceReference4.OperateLog()
            //{
            //    CreateDate = DateTime.Now,
            //    DataId = "DataId",
            //    Id = 0,
            //    IP = "IP",
            //    LoginName = "LoginName",
            //    ModuleName = "ModuleName",
            //    OperationType = "OperationType",
            //    ParentModule = "ParentModule",
            //    SystemTypeId = "0",
            //    UserCode = "UserCode",
            //    UserName = "UserName"
            //});






            //=========================
            //ServiceReference2.CalculatorClient c = new ServiceReference2.CalculatorClient();
            //c.add(1.1, 2.2);

            //ServiceReference1.CalculatorClient client = new ServiceReference1.CalculatorClient();
            ////查询客户端已安装的证书
            //client.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySubjectName, "BCode");
            //var q = client.add(1, 2);
            //Console.WriteLine(client.add(1, 2));
            Console.Read();

        }
    }
    [Description("查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书查询客户端已安装的证书")]
    public class Test
    {

        private int id;
        [Description]
        public int Id
        {
            get { return id; }
            set { id = value; }
        }
        public void Test1()
        {
        }
    }

    //public class Test
    //{
    //    public T Add(T num1, T num2)  where T:struct
    //    {
    //        //参数表达式树节点1
    //        ParameterExpression para1 = Expression.Parameter(typeof(T), "left");
    //        //参数表达式树节点2
    //        ParameterExpression para2 = Expression.Parameter(typeof(T), "right");
    //        //两个参数节点构成关系为求和的二叉树节点
    //        BinaryExpression expsAdd = Expression.LessThan(para1, para2);
    //        //定义lambda表达式
    //        Expression> exps = Expression.Lambda
    //            >(expsLessThan, new ParameterExpression[] { para1, para2 });
    //        //转化为匿名函数指针
    //        Func myFunction = exps.Compile();
    //        //返回执行结果
    //        return myFunction(num1, num2);
    //    }
    //}



    //// type parameter T in angle brackets
    //public class GenericList<T>
    //{
    //    // The nested class is also generic on T
    //    private class Node
    //    {
    //        // T used in non-generic constructor
    //        public Node(T t)
    //        {
    //            next = null;
    //            data = t;
    //        }

    //        private Node next;
    //        public Node Next
    //        {
    //            get { return next; }
    //            set { next = value; }
    //        }

    //        // T as private member data type
    //        private T data;

    //        // T as return type of property
    //        public T Data
    //        {
    //            get { return data; }
    //            set { data = value; }
    //        }
    //    }

    //    private Node head;

    //    // constructor
    //    public GenericList()
    //    {
    //        head = null;
    //    }

    //    // T as method parameter type:
    //    public void AddHead(T t)
    //    {
    //        Node n = new Node(t);
    //        n.Next = head;
    //        head = n;
    //    }

    //    public IEnumerator<T> GetEnumerator()
    //    {
    //        Node current = head;

    //        while (current != null)
    //        {
    //            yield return current.Data;
    //            current = current.Next;
    //        }
    //    }
    //}


}
